#!/usr/bin/env python

def select_sort(nums):
    for i in range(len(nums) - 1, 0, -1):
        pos = 0
        for j in range(i + 1):
            if nums[j] >= nums[pos] :
                pos = j

        nums[i], nums[pos] = nums[pos], nums[i]

    return nums

if __name__ == "__main__":
    import random

    nums = [random.randint(0, 100) for _ in range(20)]
    print(nums)
    print(select_sort(nums))